package com.acane.instagram.feature.main

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.acane.instagram.feature.splash.SplashRoute


const val SPLASH_ROUTE = "splash"

fun NavGraphBuilder.splashScreen(
    toMain: () -> Unit = {},
) {
    composable(SPLASH_ROUTE) {
        SplashRoute(
            toMain
        )
    }
}


const val MAIN_ROUTE = "main"

@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
fun NavGraphBuilder.mainScreen(
    toProfile: (String) -> Unit,
    toLogin: () -> Unit,
    toMain: () -> Unit,
    toFriend: () -> Unit,
    toMe: () -> Unit,
    toPost: (String, Int) -> Unit,
    toNotification: () -> Unit,
    toFollow: (String, String) -> Unit,
    toSearchDetail: () -> Unit,
    toEditMe: () -> Unit,
    toRegister: () -> Unit,
    toCollection: () -> Unit,
    ) {
    composable(MAIN_ROUTE) {
        MainRoute(
            toLogin = toLogin,
            toMain = toMain,
            toProfile = toProfile,
            toFriend = toFriend,
            toMe = toMe,
            toPost = toPost,
            toNotification = toNotification,
            toFollow = toFollow,
            toSearchDetail = toSearchDetail,
            toEditMe = toEditMe,
            toRegister = toRegister,
            toCollection = toCollection,
        )
    }
}

fun NavController.navigateToMain(): Unit {
    navigate(MAIN_ROUTE)
}